import request from "@/utils/request";
// 调用权限
export default {
  getFlowsteps(id) {
    return request({
      url: "/api/tickets/" + id + "/flowsteps/",
      method: "get"
    });
  },
  getFlowlogs(id,data) {
    return request({
      url: "/api/tickets/" + id + "/flowlogs/",
      method: "get",
      params:data
    });
  },
  getDetailInfo(id) {
    return request({
      url: "/api/tickets/" + id + "/",
      method: "get"
    });
  },
  toTicketsDandle(id, data) {
    return request({
      url: "/api/tickets/" + id + "/",
      method: "put",
      data: data
    });
  },
  getTransitions(id) {
    return request({
      url: "/api/tickets/" + id + "/transitions/",
      method: "get"
    });
  },
  //转交
  toDeliver(id, data) {
    return request({
      url: "/api/tickets/" + id + "/deliver/",
      method: "post",
      data: data
    });
  },
  //加签
  toAddNode(id, data) {
    return request({
      url: "/api/tickets/" + id + "/add_node/",
      method: "post",
      data: data
    });
  },
  //加签完成
  toAddNodeEnd(id, data) {
    return request({
      url: "/api/tickets/" + id + "/add_node_end/",
      method: "post",
      data: data
    });
  },
  //强制关闭工单
  toClose(id, data) {
    return request({
      url: "/api/tickets/" + id + "/close/",
      method: "post",
      data: data
    });
  },
  //修改工单状态
  toChangeState(id, data) {
    return request({
      url: "/api/tickets/" + id + "/state/",
      method: "put",
      data: data
    });
  },
  //撤回工单
  toRetreat(id, data) {
    return request({
      url: "/api/tickets/" + id + "/retreat/",
      method: "post",
      data: data
    });
  },
  //获得干预权限
  toCanIntervene(id, data) {
    return request({
      url: "/api/workflows/" + id + "/can_intervene/",
      method: "get",
      data: data
    });
  },
  //接单
  toAccept(id, data) {
    return request({
      url: "/api/tickets/" + id + "/accept/",
      method: "post",
      data: data
    });
  },
  //获得流程图数据
  simpleDescription(id, data) {
    return request({
      url: "/api/workflows/" + id + "/simple_description/",
      method: "get",
      param: data
    });
  },
  //动态传入url获得参数
  getSomething(url,data) {
    return request({
      url: url,
      method: "get",
      params: data
    });
  },
  getSomethingPost(url,data) {
    return request({
      url: url,
      method: "post",
      data
    });
  },
  getAccountMsgper(data) {
    return request({
      url: "/api/accounts/msg_per/",
      method: "get",
      params: data
    });
  },
  workflowsIsSelect( data) {
    return request({
      url: "/api/workflows/is_select/",
      method: "get",
      params:data
    });
  },
  getTicketsUserMsg(data) {
    return request({
      url: "/api/tickets/user_msg/",
      method: "get",
      params: data
    });
  },
  setTicketsCancel(id,data) {//取消，回到草稿，无日志
    return request({
      url: "/api/tickets/" + id + "/cancel/",
      method: "get",
      data
    });
  },
  setTicketsRecall(id,data) {//撤回，回到待办，有日志
    return request({
      url: "/api/tickets/" + id + "/recall/",
      method: "post",
      data
    });
  },
  setTicketsRefund(id,data) {//退回到上一个处理人
    return request({
      url: "/api/tickets/" + id + "/refund/",
      method: "post",
      data
    });
  },
  changTicketsStatus(id, data) {
    return request({
      url: "/api/tickets/" + id + "/status/",
      method: "post",
      data
    });
  },
};
